package com.aooci.ordercat.domain;

import java.io.Serializable;
import java.util.Calendar;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Entity
@Table(name = "RECETTE")
@NamedQueries({
    @NamedQuery(name="RECETTE.selectByAcrossDayConditons",
                query="SELECT r FROM Recette r WHERE (YEAR(r.orderCreation) =:selectedYear AND MONTH(r.orderCreation) =:selectedMonth AND DAY_OF_MONTH(r.orderCreation) =:selectedDay AND r.ordercat.status = :status AND HOUR(r.orderCreation) > :divideTime) OR (YEAR(r.orderCreation) =:nextYear AND MONTH(r.orderCreation) =:nextMonth AND DAY_OF_MONTH(r.orderCreation) =:nextDay AND r.ordercat.status = :status AND HOUR(r.orderCreation) < :divideTime) ORDER BY r.id"),
    @NamedQuery(name="RECETTE.deleteByOrdercatId",
                query="DELETE FROM Recette r WHERE r.ordercat.id = :ordercatId"),
    @NamedQuery(name="RECETTE.findByOrdercatId",
                query="SELECT r FROM Recette r WHERE r.ordercat.id = :ordercatId"),
    @NamedQuery(name="RECETTE.findCheckouVoByOrdercatId",
                query="SELECT new com.aooci.ordercat.vo.CheckoutVo(r.cash, r.card, r.cheque, r.offert, r.tip, r.discountRate, r.discount, r.finalTotal) FROM Recette r WHERE r.ordercat.id = :ordercatId"),            
})
public class Recette extends IdentityEntity implements Serializable {

	private static final long serialVersionUID = 1L;
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ORDERCAT_ID")
	private Ordercat ordercat;
	
	@Column(name = "ORDER_CREATION", nullable = false, updatable = false)
	@Temporal(TemporalType.TIMESTAMP)
	private Calendar orderCreation;
	
	@Column(name = "ORDER_LABEL")
	private String orderLabel;
	
	@Column(name = "NUMBER_OF_CLIENT")
	private Integer numberOfClient;
	
	@Column(name = "CASH")
	private float cash;
	
	@Column(name = "CARD")
	private float card;
	
	@Column(name = "CHEQUE")
	private float cheque;
	
	@Column(name = "TVA_6")
	private float tva6;
	
	@Column(name = "TVA_12")
	private float tva12;
	
	@Column(name = "TVA_21")
	private float tva21;

	@Column(name = "DISCOUNT_RATE")
	private Integer discountRate;
	
	@Column(name = "DISCOUNT")
	private float discount;
	
	@Column(name = "OFFERT")
	private float offert;
	
	@Column(name = "TIP")
	private float tip;
	
	@Column(name = "FINAL_TOTAL")
	private float finalTotal;

	/**
	 * @return the ordercat
	 */
	public Ordercat getOrdercat() {
		return ordercat;
	}

	/**
	 * @param ordercat the ordercat to set
	 */
	public void setOrdercat(Ordercat ordercat) {
		this.ordercat = ordercat;
	}

	/**
	 * @return the orderCreation
	 */
	public Calendar getOrderCreation() {
		return orderCreation;
	}

	/**
	 * @param orderCreation the orderCreation to set
	 */
	public void setOrderCreation(Calendar orderCreation) {
		this.orderCreation = orderCreation;
	}

	/**
	 * @return the orderLabel
	 */
	public String getOrderLabel() {
		return orderLabel;
	}

	/**
	 * @param orderLabel the orderLabel to set
	 */
	public void setOrderLabel(String orderLabel) {
		this.orderLabel = orderLabel;
	}

	/**
	 * @return the numberOfClient
	 */
	public Integer getNumberOfClient() {
		return numberOfClient;
	}

	/**
	 * @param numberOfClient the numberOfClient to set
	 */
	public void setNumberOfClient(Integer numberOfClient) {
		this.numberOfClient = numberOfClient;
	}

	/**
	 * @return the cash
	 */
	public float getCash() {
		return cash;
	}

	/**
	 * @param cash the cash to set
	 */
	public void setCash(float cash) {
		this.cash = cash;
	}

	/**
	 * @return the card
	 */
	public float getCard() {
		return card;
	}

	/**
	 * @param card the card to set
	 */
	public void setCard(float card) {
		this.card = card;
	}

	/**
	 * @return the cheque
	 */
	public float getCheque() {
		return cheque;
	}

	/**
	 * @param cheque the cheque to set
	 */
	public void setCheque(float cheque) {
		this.cheque = cheque;
	}

	/**
	 * @return the tva6
	 */
	public float getTva6() {
		return tva6;
	}

	/**
	 * @param tva6 the tva6 to set
	 */
	public void setTva6(float tva6) {
		this.tva6 = tva6;
	}

	/**
	 * @return the tva12
	 */
	public float getTva12() {
		return tva12;
	}

	/**
	 * @param tva12 the tva12 to set
	 */
	public void setTva12(float tva12) {
		this.tva12 = tva12;
	}

	/**
	 * @return the tva21
	 */
	public float getTva21() {
		return tva21;
	}

	/**
	 * @param tva21 the tva21 to set
	 */
	public void setTva21(float tva21) {
		this.tva21 = tva21;
	}

	/**
	 * @return the discountRate
	 */
	public Integer getDiscountRate() {
		return discountRate;
	}

	/**
	 * @param discountRate the discountRate to set
	 */
	public void setDiscountRate(Integer discountRate) {
		this.discountRate = discountRate;
	}

	/**
	 * @return the discount
	 */
	public float getDiscount() {
		return discount;
	}

	/**
	 * @param discount the discount to set
	 */
	public void setDiscount(float discount) {
		this.discount = discount;
	}

	/**
	 * @return the offert
	 */
	public float getOffert() {
		return offert;
	}

	/**
	 * @param offert the offert to set
	 */
	public void setOffert(float offert) {
		this.offert = offert;
	}

	/**
	 * @return the tip
	 */
	public float getTip() {
		return tip;
	}

	/**
	 * @param tip the tip to set
	 */
	public void setTip(float tip) {
		this.tip = tip;
	}

	/**
	 * @return the finalTotal
	 */
	public float getFinalTotal() {
		return finalTotal;
	}

	/**
	 * @param finalTotal the finalTotal to set
	 */
	public void setFinalTotal(float finalTotal) {
		this.finalTotal = finalTotal;
	}

}
